#pragma once
#include <memory>
#include <SFML/Graphics/Font.hpp>
#include <nice2d/entity.h>

class TextPrinter final : public Entity
{
public:
    explicit TextPrinter(const sf::Vector2f &size = sf::Vector2f());
    ~TextPrinter();
public:
    void setString(const sf::String &string);
    void setFont(const std::string& file);
    void setTextSize(int32_t size);
    void setTextColor(const sf::Color &color);

    void start();
    void skip();

    void setShaking(bool shaking);

    boost::signals2::signal<void()> typingFinished;
public:
    PTree serialize() override;
    void deserialize(const PTree &node) override;
protected:
    void onPositionChanged()override;
    void onSizeChanged()override;
    void onUpdateNode(float deltaTime)override;
    void onDrawNode(sf::RenderTarget &target, sf::RenderStates states) const override;
private:
    std::unique_ptr<class TextPrinterData> data;
};


